package br.com.j7.jdesk.persistence.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Version;

import br.com.j7.jdesk.persistence.listener.CityListener;

/**
 * 
 * 
 * @author Edivando Alves
 *
 */
@Entity
@EntityListeners(value={CityListener.class})
public class Cities implements Serializable{

	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer idCity;
	
	@Column(nullable=true, length=150)
	private String cdCity;
	
	private String cdState;
	
	private String cdCountry;
	
	@Version
	private Integer nrVersion;
	
	public Cities() {
	}

	public Integer getIdCity() {
		return idCity;
	}

	public void setIdCity(Integer idCity) {
		this.idCity = idCity;
	}

	public String getCdCity() {
		return cdCity;
	}

	public void setCdCity(String cdCity) {
		this.cdCity = cdCity;
	}

	public String getCdState() {
		return cdState;
	}

	public void setCdState(String cdState) {
		this.cdState = cdState;
	}

	public String getCdCountry() {
		return cdCountry;
	}

	public void setCdCountry(String cdCountry) {
		this.cdCountry = cdCountry;
	}

	public Integer getNrVersion() {
		return nrVersion;
	}
	
	public void setNrVersion(Integer nrVersion) {
		this.nrVersion = nrVersion;
	}
	
	@Override
	public int hashCode() {
		return idCity;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Cities other = (Cities) obj;
		if (idCity == null) {
			if (other.idCity != null)
				return false;
		} else if (!idCity.equals(other.idCity))
			return false;
		return true;
	}
	
	

}
